local aixinmengxiang = fk.CreateSkill {
  name = "aixinmengxiang",
  tags = { Skill.Wake },
}

Fk:loadTranslationTable{
  ["aixinmengxiang"] = "爱心梦想",
  [":aixinmengxiang"] = "觉醒技，准备阶段开始时，若你发动过【甜梦愈心】，你获得技能【甜梦之镜】令所有梦之队势力玩家获得技能【心愿疗愈】",
}

aixinmengxiang:addEffect(fk.EventPhaseStart, {
  anim_type = "support",
  can_trigger = function(self, event, target, player, data)
    return target == player and player:hasSkill(aixinmengxiang.name) and player.phase == Player.Start and
      player:usedSkillTimes(aixinmengxiang.name, Player.HistoryGame) == 0
  end,
  can_wake = function(self, event, target, player, data)
        return player:usedSkillTimes("tianmengyvxin", Player.HistoryGame) > 0
  end,
  on_use = function(self, event, target, player, data)
    local room = player.room
    room:handleAddLoseSkills(player, "tianmengzhijing")
    for _, p in ipairs(room:getAlivePlayers()) do
      -- 为每个存活玩家添加 "n_fenliang" 技能
      -- 第三个参数 nil 表示不指定技能的额外参数，第四个参数 false 表示不是临时添加技能
      if p.kingdom == "dream" then
        -- 指示目标玩家指向额外目标
        room:handleAddLoseSkills(p, "xinyuanliaoyv")
     end
    end
  end,
})


return aixinmengxiang
